using UnityEngine;
using System.Collections;


public class Bullet : MonoBehaviour 
{
	public float bulletSpeed = 0.1f;
	int damage = 5;
	// Use this for initialization
	void Start ()
	{
	
	}
	
	// Update is called once per frame
	void Update ()
	{
		transform.position += new Vector3(0, bulletSpeed, 0);
		
		if (transform.position.y >= 7.0f)
		{
			Destroy(this.gameObject);
		}
	}
	//on collision with other object must destroy both bullet and object
	void OnTriggerEnter(Collider other)
	{
		//If it Collides with an object other than the player
		if (other.tag == "Enemy")
		{
			Destroy(this.gameObject);
			Destroy(other.gameObject);
		}
	}
}
